package com.hankol.community.fragment

import android.app.Activity
import android.content.Context
import android.os.CountDownTimer
import android.view.Gravity
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import androidx.lifecycle.Observer
import androidx.recyclerview.widget.RecyclerView
import com.baselibrary.MessageBus
import com.baselibrary.bean.CommentEnum
import com.baselibrary.bean.FriendListBean
import com.baselibrary.extension.checkNotNull
import com.baselibrary.manager.DialogManager
import com.baselibrary.manager.SensorsDataManager
import com.baselibrary.permission.callback.PermissionsCall
import com.baselibrary.router.ActivityRouter
import com.baselibrary.utils.*
import com.okhttp.comment.CommentBean
import com.baselibrary.activity.BaseLazyFragment
import com.hankol.community.R
import com.hankol.community.adapter.FollowDynamicAdapter
import com.hankol.community.arouter.CommunityHelp
import com.hankol.community.bean.FollowDynamicBean
import com.hankol.community.bean.FollowUsersBeanItem
import com.hankol.community.databinding.FragmentCommunityFollowBinding
import com.hankol.community.databinding.PopupCommentlistBinding
import com.hankol.community.viewmodel.CommunityViewModel
import com.hankol.community.viewmodel.VideoDetailsViewModel
import com.okhttp.comment.BaseCommentAdapter
import com.okhttp.comment.CommentConstant
import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode

/**
 * @description 首页-关注页
 * @author yuyang
 * @time 2022/4/25 4:05 下午
 */
class CommunityFollowFragment : BaseLazyFragment(false), View.OnClickListener, OnRefreshLoadMoreListener {
    private lateinit var mDataBinding: FragmentCommunityFollowBinding
    private lateinit var mViewModel: CommunityViewModel
    private lateinit var mVideoModel: VideoDetailsViewModel
    private lateinit var dynamicAdapter: FollowDynamicAdapter
    private var mCurrentPage = 1
    private var mNoMoreData = false
    private lateinit var mAutoPlayTool: AutoPlayTool
    val communityHelp: CommunityHelp = ActivityRouter.getARouterInterface(ActivityRouter.COMMUNITY.COMMUNITY_HELP)
    private var mPopupBinding: PopupCommentlistBinding? = null
    private var mCommentPopup: PopupWindow? = null
    private var haveFollowUsers = false//是否有关注的人
    private var haveFollowDynamic = false //是否关注的人有动态
    private var mPage = 1
    private var mDynamicId: Int = 0
    private var mSelectedUserName = ""
    private var mCommentBean: CommentBean.DataBean? = null
    private var mCommentCount = 0
    private var friendsList: List<FriendListBean> = ArrayList()
    private var firstPageData: FollowDynamicBean.DataBeanX = FollowDynamicBean.DataBeanX()
    private val userListBean = FollowDynamicBean.DataBeanX.DataBean()
    private lateinit var countDownTimer: CountDownTimer
    private var latestTimestamp = 0L
    private var isFirstRequest = true
    private var isAutoRefresh = false
    private lateinit var publishBean: FollowDynamicBean.DataBeanX.DataBean

    companion object {
        var isJumpAct = false
        var FOLLOW_MORE_STATE = 9
        fun newInstance(): CommunityFollowFragment {
            return CommunityFollowFragment()
        }
    }

    override fun getLayoutId(): Int {
        return R.layout.fragment_community_follow
    }

    override fun init() {
        mDataBinding = getDataBinding<FragmentCommunityFollowBinding>()
        if (!EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().register(this)
        }
        SensorsDataManager.instance.onCreateTime()
        initView()
        addObserver()
    }

    override fun lazyLoadData() {
        requestData()
    }

    fun initView() {
        mDataBinding.llLoading.visibility = View.VISIBLE
        mViewModel = getFragmentViewModelProvider(this).get(CommunityViewModel::class.java)
        mVideoModel = getFragmentViewModelProvider(this).get(VideoDetailsViewModel::class.java)
        dynamicAdapter = FollowDynamicAdapter(activity as Context, ArrayList(), mViewModel)
        MarginUtils.setViewGroupMarginTopIncludeStatusBar(attachActivity, mDataBinding.rlCommunityFollow, 44)
        MarginUtils.setViewGroupMarginTopIncludeStatusBar(attachActivity, mDataBinding.rlPublishStatus, 44)
        mDataBinding.rvCommunityFollow.adapter = dynamicAdapter
        mDataBinding.rlCommunityFollow.setOnRefreshListener {
            refreshData()
        }
        mDataBinding.rlCommunityFollow.setOnLoadMoreListener {
            if (mNoMoreData) {
                mDataBinding.rlCommunityFollow.finishLoadMore()
                return@setOnLoadMoreListener
            }
            requestData()
        }
        mViewModel.reqFriendList()
        mAutoPlayTool = AutoPlayTool(50, 1)
        mDataBinding.rvCommunityFollow.addOnScrollListener(object : RecyclerView.OnScrollListener() {
            override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
                super.onScrollStateChanged(recyclerView, newState)
                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
                    mAutoPlayTool.onActiveWhenNoScrolling(recyclerView, context)
                }
            }

            override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
                super.onScrolled(recyclerView, dx, dy)
                mAutoPlayTool.onScrolledAndDeactivate()
            }
        })
        dynamicAdapter.setCallback(object : FollowDynamicAdapter.Callback {

            override fun onClickShare(position: Int, item: FollowDynamicBean.DataBeanX.DataBean) {
                showShare(item)
            }

            override fun onClickComment(position: Int, item: FollowDynamicBean.DataBeanX.DataBean) {
                showCommentPop(item)
            }

            override fun onClickNoCare(userId: Int) {
                mViewModel.reqNoCare(userId)
            }
        })
    }

    //底部评论弹窗
    private fun showCommentPop(item: FollowDynamicBean.DataBeanX.DataBean) {
        mPage = 1
        mDynamicId = item.id
        mSelectedUserName = item.name
        mCommentCount = item.commentNum
        if (!SpUtils.getInstance().isLogin) {
            AppManager.getAppManager().openLoginPage()
            return
        }
        //打开评论
        mPopupBinding = mViewModel.openCommentView(this, mCommentCount)
        mViewModel.reqCommentList(mPage, mDynamicId.toLong(), 0, CommentEnum.COMMENT_DYNAMIC.commentType)
        mCommentPopup = communityHelp.showCommentPop(activity as Activity, mPopupBinding!!.root, mDataBinding.rvCommunityFollow, Gravity.BOTTOM)
        mCommentPopup?.showAtLocation(mDataBinding.rvCommunityFollow, Gravity.BOTTOM, 0, 0)
        communityHelp.setBackgroundAlpha(activity as Activity)

    }

    //动态分享
    private fun showShare(selectedDynamicBean: FollowDynamicBean.DataBeanX.DataBean) {
        mViewModel.showShare(selectedDynamicBean, activity as Activity, communityHelp, mVideoModel.changeFriend(friendsList))
    }


    private fun addObserver() {
        //我关注的人
        mViewModel.followUsersLD.observe(viewLifecycleOwner, Observer {
            mDataBinding.llLoading.postDelayed(Runnable {
                //解决华为手机闪一下
                mDataBinding.llLoading.visibility = View.GONE
            }, 100)
            if (it != null) {
                haveFollowUsers = it.followCount != 0//没有关注的人
                val defaultFollowUser = FollowUsersBeanItem()
                if (SpUtils.getInstance().loadUserBean != null && SpUtils.getInstance().loadUserBean.data != null) {
                    defaultFollowUser.icon = SpUtils.getInstance().loadUserBean.data.icon
                    defaultFollowUser.name = SpUtils.getInstance().loadUserBean.data.name
                    defaultFollowUser.isMyself = true
                    it.userList.add(0, defaultFollowUser)
                }
                if (it.followCount > FOLLOW_MORE_STATE) {
                    //超过9个用户添加【更多】
                    val moreFollowUser = FollowUsersBeanItem()
                    moreFollowUser.name = "更多"
                    moreFollowUser.isMore = true
                    it.userList.add(moreFollowUser)
                }
                userListBean.itemType = FollowDynamicAdapter.TYPE_USER_LIST
                userListBean.followUsersBeanItems = it.userList
                mViewModel.reqFollowDynamicList(mCurrentPage)
            } else {
                mDataBinding.rlCommunityFollow.finishRefresh()
            }
        })
        //关注的动态
        mViewModel.followDynamicLD.observe(viewLifecycleOwner, Observer { it ->
            mDataBinding.rlCommunityFollow.finishRefresh()
            if (it?.data != null) {
                if (mCurrentPage == 1) {
                    //取最新状态的createTime判断是否显示提示
                    if (!isAutoRefresh) {
                        var currentTimestamp = 0L
                        if (it.data.size >= 2) {
                            currentTimestamp = if (it.data[0].createTime > it.data[1].createTime) {
                                it.data[0].createTime
                            } else {
                                it.data[1].createTime
                            }
                        } else if (it.data.size == 1) {
                            currentTimestamp = it.data[0].createTime
                        } else if (it.data.size == 0) {
                            latestTimestamp = 0L
                        }
                        if (latestTimestamp < currentTimestamp && isVisibleToUser && !isFirstRequest) {
                            latestTimestamp = currentTimestamp
                        }
                    } else {
                        if (isVisibleToUser && !isFirstRequest) {
                        }
                    }
                    if (isAutoRefresh) {
                        val iterator = it.data.iterator()
                        while (iterator.hasNext()) {
                            if (iterator.next().id == publishBean.id) {
                                iterator.remove()
                            }
                        }
                    }
                    firstPageData = it
                    haveFollowDynamic = false
                    for (d in it.data) {
                        if (d.uid != SpUtils.getInstance().userId.toInt()) {
                            haveFollowDynamic = true
                            break
                        }
                    }
                    firstPageData.data.add(0, userListBean)
                    if (haveFollowUsers && haveFollowDynamic) {//有关注用户且关注用户有动态时显示感兴趣 其他都显示推荐卡片
                        mViewModel.reqInterestUsers()
                    } else {
                        mViewModel.reqRecommendUsers(FollowDynamicAdapter.RECOMMEND_EMPTY_INDEX, FollowDynamicAdapter.RECOMMEND_EMPTY_SIZE)
                    }
                } else {
                    mDataBinding.rlCommunityFollow.finishLoadMore()
                    dynamicAdapter.data.addAll(it.data)
                    dynamicAdapter.notifyDataSetChanged()
                }
                if (!it.isHasnext) {
                    mNoMoreData = true
                    mDataBinding.rlCommunityFollow.finishLoadMore()
                } else {
                    mCurrentPage++
                }
            } else {
                mNoMoreData = true
                mDataBinding.rlCommunityFollow.finishLoadMore()
            }
        })

        mViewModel.interestUsersLD.observe(viewLifecycleOwner, Observer {
            mDataBinding.rlCommunityFollow.finishRefresh()
            mDataBinding.rlCommunityFollow.finishLoadMore()
            if (it != null && it.isNotEmpty()) {
                val interestBean = FollowDynamicBean.DataBeanX.DataBean()
                interestBean.itemType = FollowDynamicAdapter.TYPE_INTEREST
                interestBean.interestUserBeans = it
                var hasAdded = false
                for (data in firstPageData.data) {
                    if (data.itemType == FollowDynamicAdapter.TYPE_INTEREST) {
                        hasAdded = true
                        break
                    }
                }
                if (!hasAdded) {
                    if (firstPageData.data.size >= 3) {
                        firstPageData.data.add(2, interestBean)
                    } else {
                        firstPageData.data.add(interestBean)
                    }
                }
            }
            dynamicAdapter.data = firstPageData.data
            dynamicAdapter.notifyDataSetChanged()
            addFirstItem()
            isFirstRequest = false
        })

        mViewModel.recommendUsersLD.observe(viewLifecycleOwner, Observer {
            mDataBinding.rlCommunityFollow.finishRefresh()
            mDataBinding.rlCommunityFollow.finishLoadMore()
            if (it != null && it.isNotEmpty()) {
                if (it.size < FollowDynamicAdapter.RECOMMEND_EMPTY_SIZE) {
                    //说明是点击【X】后，补位数据
                    dynamicAdapter.mCardLeakCall?.onCardLeak(it)
                    return@Observer
                }
                val recommendBean = FollowDynamicBean.DataBeanX.DataBean()
                recommendBean.itemType = FollowDynamicAdapter.TYPE_RECOMMEND
                recommendBean.isHasFollowUser = haveFollowUsers//有关注的人并且关注的人发布了动态
                recommendBean.recommendUserBeans = it
                var hasAdded = false
                for (data in firstPageData.data) {
                    if (data.itemType == FollowDynamicAdapter.TYPE_RECOMMEND) {
                        hasAdded = true
                        break
                    }
                }
                if (!hasAdded) {
                    if (firstPageData.data.size >= 3) {
                        //如果有动态
                        firstPageData.data.add(2, recommendBean)
                    } else {
                        firstPageData.data.add(recommendBean)
                    }
                }
            }
            dynamicAdapter.data = firstPageData.data
            dynamicAdapter.notifyDataSetChanged()
            addFirstItem()
            isFirstRequest = false
        })

        mViewModel.noCareLD.observe(viewLifecycleOwner, Observer { it ->
            if (it) {
                ToastUtils.showShort(activity, "不会再为你推荐该用户")
                mViewModel.reqRecommendUsers(FollowDynamicAdapter.RECOMMEND_EMPTY_SIZE, FollowDynamicAdapter.RECOMMEND_EMPTY_INDEX)
            }
        })

        mViewModel.commentListLiveData.observe(viewLifecycleOwner, Observer {
            mPopupBinding?.smartComment?.finishLoadMore()
            mPopupBinding?.smartComment?.finishRefresh()
            if (it != null) {
                mCommentBean = it
                mPopupBinding?.PBarSldComment?.visibility = View.GONE
                mPopupBinding?.BaseCommentView?.visibility = View.VISIBLE
                mPopupBinding?.BaseCommentView?.commentNetData(it, mPage)
                mPage++
            }
        })

        //请求好友列表
        mViewModel.friendLiveData.observe(viewLifecycleOwner, Observer {
            it?.let {
                friendsList = it
            }
        })
    }

    private fun addFirstItem() {
        if (isAutoRefresh) {
            if (dynamicAdapter.data.size > 1) {
                dynamicAdapter.data.add(1, publishBean)
                dynamicAdapter.notifyItemInserted(1)
            }

            isAutoRefresh = false
        }
    }

    fun doRefresh() {
        mDataBinding.rvCommunityFollow.scrollToPosition(0)
        mDataBinding.rlCommunityFollow.autoRefresh()
    }

    private fun refreshData() {
        mCurrentPage = 1
        mNoMoreData = false
        requestData()
    }

    private fun requestData() {
        mViewModel.reqFollowList()
    }

    //EventBus 接受方法
    @Subscribe(threadMode = ThreadMode.MAIN) fun onEvent(messageBus: MessageBus) {
        when (messageBus.codeType) {
            MessageBus.msgid_publish_dynamic -> {
                mViewModel.loadPermissions(activity as Activity, object : PermissionsCall() {
                    override fun permissionsPass() {
                        communityHelp.goPublish(activity as Activity)
                    }
                })
            }
            MessageBus.msgid_jump_to_detail -> {
                isJumpAct = true
            }
            MessageBus.msgid_send_comment_success -> {
                mCommentCount++
                mPopupBinding?.let {
                    it.tvContentCount.text = "共${mCommentCount}条评论"
                }
                val totalData: java.util.ArrayList<FollowDynamicBean.DataBeanX.DataBean> = dynamicAdapter.data
                for ((index, item) in totalData.withIndex()) {
                    if (item.itemType == 0) {
                        if (item.id == mDynamicId) {
                            item.commentNum++
                            dynamicAdapter.notifyItemChanged(index)
                        }
                    }
                }
                mPage = 1
                mViewModel.reqCommentList(mPage, mDynamicId.toLong(), 0, CommentEnum.COMMENT_DYNAMIC.commentType)
            }
            MessageBus.msgid_login_success,MessageBus.msgid_visitor_login_success, MessageBus.msgId_follow_and_cancel, MessageBus.msgid_exit_or_logout -> {
                refreshData()
            }
            MessageBus.msgid_notify_start_publish -> {
                initStatusView()
                GlideUtils.loadImg_228(activity, messageBus.param1.toString(), mDataBinding.rivCover)
            }
            MessageBus.msgid_notify_close_publish -> closeStatusView()
            MessageBus.msgid_notify_total_status -> {
                mDataBinding.tvUploadStatus.text = messageBus.param1.toString()
                when (messageBus.param1.toString()) {
                    "合成失败", "上传失败", "发布失败" -> {
                        mDataBinding.ivCancelUpload.visibility = View.VISIBLE
                        mDataBinding.ivReUpload.visibility = View.VISIBLE
                        mDataBinding.ivCancelUpload.setOnClickListener(this)
                        mDataBinding.ivReUpload.setOnClickListener(this)
                    }
                }
            }
            MessageBus.msgid_notify_total_progress -> {
                mDataBinding.tvProcess.text = "${messageBus.param1}%"
                mDataBinding.pbProcess.progress = messageBus.param1 as Int
            }
            MessageBus.msgid_notify_start_timer -> {
                startTimer(messageBus.param1 as Int)
            }
            MessageBus.msgid_notify_stop_timer -> {
                if (countDownTimer != null) {
                    countDownTimer.cancel()
                }
            }

            MessageBus.msgid_notify_error_msg -> {
                ToastUtils.showShort(activity, messageBus.param1 as String)
            }
            MessageBus.msgId_change_dynamic_like_status -> {
                for ((index, d) in dynamicAdapter.data.withIndex()) {
                    if (d.id == messageBus.param1) {
                        if (d.isSupported == 0) {
                            d.isSupported = 1
                        } else if (d.isSupported == 1) {
                            d.isSupported = 0
                        }
                        d.supportNum = if (d.isSupported == 1) d.supportNum.plus(1) else d.supportNum.minus(1)
                        dynamicAdapter.notifyItemChanged(index)
                        break
                    }
                }
            }

            MessageBus.msgId_change_dynamic_collect_status -> {
                for ((index, d) in dynamicAdapter.data.withIndex()) {
                    if (d.id == messageBus.param1) {
                        if (d.isFavorited == 0) {
                            d.isFavorited = 1
                        } else if (d.isFavorited == 1) {
                            d.isFavorited = 0
                        }
                        d.favoriteNum = if (d.isFavorited == 1) d.favoriteNum.plus(1) else d.favoriteNum.minus(1)
                        dynamicAdapter.notifyItemChanged(index)
                        break
                    }
                }
            }

            MessageBus.msgid_notify_publish_success -> {
                publishBean = messageBus.param1 as FollowDynamicBean.DataBeanX.DataBean
                publishBean.icon = SpUtils.getInstance().loadUserBean.data.icon
                publishBean.name = SpUtils.getInstance().loadUserBean.data.name
                mDataBinding.rlCommunityFollow.postDelayed(Runnable {
                    isAutoRefresh = true
                    mDataBinding.rvCommunityFollow.scrollToPosition(0)
                    mDataBinding.rlCommunityFollow.autoRefresh()
                }, 1000)
                mDataBinding.rlCommunityFollow.postDelayed(Runnable {
                    EventBusUtils.sendNotify(MessageBus.msgId_go_share_poster)
                }, 1500)
                if (publishBean.rewardScore > 0) {
                    DialogManager.showCoinDialog(activity, "发布成功", publishBean.rewardScore)
                }
            }
        }
    }

    private fun closeStatusView() {
        mDataBinding.rlPublishStatus.visibility = View.GONE
        mDataBinding.ivCancelUpload.visibility = View.GONE
        mDataBinding.ivReUpload.visibility = View.GONE
        mDataBinding.tvProcess.text = "0%"
        mDataBinding.pbProcess.progress = 0
    }

    private fun initStatusView() {
        mDataBinding.rlPublishStatus.visibility = View.VISIBLE
        mDataBinding.ivCancelUpload.visibility = View.GONE
        mDataBinding.ivReUpload.visibility = View.GONE
        mDataBinding.tvProcess.text = "0%"
        mDataBinding.pbProcess.progress = 0
    }

    private fun startTimer(total: Int) {
        countDownTimer = object : CountDownTimer(9000, 1000) {
            override fun onTick(millisUntilFinished: Long) {
                val process = (9000 - millisUntilFinished) / 1000 * (90 / total)
                if (process < 100) {
                    mDataBinding.tvProcess.text = "${process}%"
                    mDataBinding.pbProcess.progress = process.toInt()
                } else {
                    cancel()
                }

            }

            override fun onFinish() {}
        }.start()
    }

    override fun onDestroyView() {
        if (EventBus.getDefault().isRegistered(this)) {
            EventBus.getDefault().unregister(this)
        }
        super.onDestroyView()
    }

    override fun onClick(v: View) {
        when (v.id) {
            R.id.ll_base_comment_empty, R.id.tv_popup_content -> {
                if (!SpUtils.getInstance().isLogin) {
                    AppManager.getAppManager().openLoginPage()
                    return
                }
                communityHelp.openCommentActivity(activity as Activity, 6, mDynamicId, "", mSelectedUserName, false, CommentConstant.COMMENT_REQUESTCODE)
            }

            R.id.iv_close_pop -> mCommentPopup?.dismiss()
            R.id.iv_cancel_upload -> {
                EventBusUtils.sendNotify(MessageBus.msgid_notify_close_publish)
            }
            R.id.iv_re_upload -> reUpload()

        }
    }

    private fun reUpload() {
        EventBusUtils.sendNotify(MessageBus.msgid_notify_re_publish)
        mDataBinding.ivCancelUpload.visibility = View.GONE
        mDataBinding.ivReUpload.visibility = View.GONE
        mDataBinding.tvProcess.text = "0%"
        mDataBinding.pbProcess.progress = 0
    }

    override fun onResume() {
        super.onResume()
        isOnResume = true
        if (isJumpAct) {
            //多层Fragment 嵌套生命周期执行拿不到。。isJumpAct 当跳转到视频详情的时候会 = true
            mAutoPlayTool.mHidedVideoListener.show()
            isJumpAct = false
        }
    }

    fun controlVideo(isPlay: Boolean) {
        if (isPlay) {
            mAutoPlayTool.mHidedVideoListener.show()
        } else {
            mAutoPlayTool.mHidedVideoListener.hide()
        }
    }

    private var isVisibleToUser: Boolean = false
    private var isOnResume: Boolean = false
    override fun setUserVisibleHint(isVisibleToUser: Boolean) {
        super.setUserVisibleHint(isVisibleToUser)
        this.isVisibleToUser = isVisibleToUser
        if (isVisibleToUser) {
            //获取页面开始时间
            SensorsDataManager.instance.onCreateTime()
        } else {
            if (isOnResume) {
                if (SensorsDataManager.instance.getBrowseTime() != 0L) {
                    SensorsDataManager.instance.communityEmphasisPageView("首页——关注页面")
                }
            }
        }
        if (attachActivity.checkNotNull()) {
            StatusBarUtil.setStatusBarDarkTheme(attachActivity, isVisibleToUser)
        }
    }

    override fun onPause() {
        super.onPause()
        //获取页面结束时间
        isOnResume = false
        if (isVisibleToUser) {
            SensorsDataManager.instance.onDestroyTime()
            if (SensorsDataManager.instance.getBrowseTime() != 0L) {
                SensorsDataManager.instance.communityEmphasisPageView("首页——关注页面")
            }
        }
    }

    override fun onRefresh(refreshLayout: RefreshLayout) {
        //评论刷新
        mPage = 1
        mViewModel.reqCommentList(mPage, mDynamicId.toLong(), 0, CommentEnum.COMMENT_DYNAMIC.commentType)
    }

    override fun onLoadMore(refreshLayout: RefreshLayout) {
        //评论加载
        mPopupBinding?.let {
            val commentNorMarAdapter: BaseCommentAdapter = it.BaseCommentView.commentAdapterType
            if (mCommentBean?.count == commentNorMarAdapter.itemCount) {
                it.smartComment.finishLoadMore()
                it.smartComment.finishRefresh()
                ToastUtils.showShort(context, "已经全部加载完成")
                return
            }
            mViewModel.reqCommentList(mPage, mDynamicId.toLong(), 0, CommentEnum.COMMENT_DYNAMIC.commentType)
        }
    }
}